package com.distribution.common.exception;

import com.distribution.common.utils.DateUtils;
import lombok.Getter;

/**
 * 业务异常
 * 
 * @author ruoyi
 */
@Getter
public final class ApiParamValidException extends RuntimeException {
    private static final long serialVersionUID = 1L;

    private Integer code;
    private String msg;
    private String time;

    /**
     * 空构造方法，避免反序列化问题
     */
    public ApiParamValidException()
    {
        this.time = DateUtils.dateTimeApi();
    }

    public ApiParamValidException(String msg)
    {
        this.msg = msg;
        this.time = DateUtils.dateTimeApi();
    }

    public ApiParamValidException(Integer code, String msg)
    {
        this.code = code;
        this.msg = msg;
        this.time = DateUtils.dateTimeApi();
    }

    public ApiParamValidException setMsg(String msg)
    {
        this.msg = msg;
        return this;
    }
}